<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>首页 Pleyel普雷耶钢琴 - 中国官方网站</title>
  <link rel="stylesheet" href="/css/heads.css">
  <link rel="stylesheet" href="/css/layout.css">
</head>

<body>
  <div class="nav">
    <ul>
      <li class="pc">
        <a href="index.html">首页</a>
      </li>
      <li class="pc">
        <a href=""> 品牌历史</a>
        <div class="fen">
          <ul class="fen_en">
            <li><a href="index_story.html">一个美丽的故事</a> </li>
            <li>传承人的故事</li>
          </ul>
        </div>
      </li>
      <li class="pc">
        <a href="poins.html">产品中心</a>
        <div class="fen">
          <ul class="fen_en fen1">
            <li><a href=""><a href="poin_sj.html">三角钢琴</a></li>
            <li><a href="poin_ls.html">立式钢琴</a></li>
          </ul>
        </div>
      </li>
      <li class="pc">
        <a href="index_zt.html">展厅</a>
      </li>
      <a class="logo" href="#"></a>
      <li class="pc"><a href="new.html?page=1">新闻首页</a></li>
      <li class="pc">服务
        <div class="fen">
          <ul class="fen_en fen2">
            <li><a href="maintain.html">保养与维护</a></li>
            <li><a href="#">经销商查询</a></li>
          </ul>
        </div>
      </li>
      <li class="pc"><a href="">联系</a></li>
      <li class="pc"><a href="lodin.html">个人中心</a></li>
    </ul>
    <span class="ico">
      <em></em>
      <em></em>
      <em></em>
    </span>
  </div>

  <div class="navBou">
    <div>首页</div>
    <div>
      品牌历史
      <p><a href="">个美丽的故事</a></p>
      <p><a href="">传承人的故事</a></p>
    </div>
    <div>
      产品中心
      <p><a href="">三角钢琴</a></p>
      <p><a href="">立式钢琴</a></p>
    </div>
    <div><a href="#">展厅</a></div>
    <div><a href="#">新闻首页</a></div>
    <div>服务
      <p><a href="">保养与维护</a></p>
      <p><a href="">经销商查询</a></p>
    </div>
  </div>

  <div class="denner">
    <div data-bg="1">
      <img src="/img/danner3.jpg" alt="">

      <img src="/img/danner.jpg" alt="">
      <img src="/img/danner2.jpg" alt="">
      <img src="/img/danner3.jpg" alt="">

      <img src="/img/danner.jpg" alt="">
    </div>
    <div>
      <span class="prve"> < </span>
      <span class="next"> > </span>
    </div>
    <div>
      <span class="cur" data-bg="1"></span>
      <span data-bg="2"></span>
      <span data-bg="3"></span>
    </div>
  </div>
  <div class="pic">
    <div>
      <div class="pic_en">
        <h2>立式钢琴</h2>
        <a href="poin_ls.html">查看详情</a>
      </div>
      <div class="pic_en">
        <h2>三角钢琴</h2>
        <a href="">查看详情</a>
      </div>
      <div class="pic_en">
        <h2>普雷耶:一个美丽的故事</h2>
        <a href="index_story.html">查看详情</a>
      </div>
    </div>
   
  </div>
  <div class="footer">
    <div class="footer-en">
      <div class="flex_box">
        <img src="/img/link1.png" alt="">
        <img src="/img/link2.png" alt="">
        <img src="/img/link3.png" alt="">
        <img src="/img/link4.png" alt="">
        <img src="/img/link5.png" alt="">
      </div>
      <div class="flex_box">
        <ul>
          <h4>客户服务</h4>
          <li><a href="">经销商查询</a></li>
          <li><a href="">联系我们</a></li>
        </ul>
        <div>
          <img src="/img/home_07.jpg" alt="">
          <img src="/img/home_09.jpg" alt="">
          <img src="/img/home_11.jpg" alt="">
          <img src="/img/home_13.jpg" alt="">
        </div>
      </div>
    </div>
  </div>
  <div class="footer2">
    <div class="footer_en">
      <div></div>
      <div>Pleyel © 2019 普雷叶乐器（上海）有限公司 沪ICP备18021165号-1</div>
    </div>
  </div>
  <script src="../js/header.js"></script>
</body>
<script>
  let dennerBox=document.querySelector('.denner>div:nth-child(1)')
  let prve=document.querySelector('.prve')
  let next=document.querySelector('.next')
  let pag=document.querySelectorAll('.denner>div:nth-child(3)>span')
  //自动轮播功能
  let dannerTsimer=setInterval(()=>{
    next.onclick()
  },3000)
  prve.onclick=function(){
    let bg=dennerBox.dataset.bg
    bg--
    dennerBox.dataset.bg=bg
    dennerBox.style.transition='1s'
    dennerBox.style.transform=`translateX(${-20*bg}%)`
    if(bg==0){
      bg=3
      dennerBox.dataset.bg=bg
      setTimeout(()=>{
        dennerBox.style.transition=''
        dennerBox.style.transform=`translateX(${-20*bg}%)`
      },1000)
     
    }
    let cur=document.querySelector('.cur')
    let index=bg-1
    cur.className=''
    pag[index].className='cur'
  }
  next.onclick=function(){
    let bg=dennerBox.dataset.bg
    bg++
    dennerBox.dataset.bg=bg
    dennerBox.style.transition='1s'
    dennerBox.style.transform=`translateX(${-20*bg}%)`
    if(bg==4){
      bg=1
      dennerBox.dataset.bg=bg
      setTimeout(()=>{
        dennerBox.style.transition=''
        dennerBox.style.transform=`translateX(${-20*bg}%)`
      },900)
    }
    let cur=document.querySelector('.cur')
    let index=bg-1
    cur.className=''
    pag[index].className='cur'
  }
  pag.forEach(el=>{
    el.onmouseover=function(){
      let bg=el.dataset.bg
      let cur=document.querySelector('.cur')
      dennerBox.style.transition='1s'
      dennerBox.style.transform=`translateX(${-20*bg}%)`
      cur.className=''
      this.className='cur'
    }
  })
  window.addEventListener('load', function() {
    window.addEventListener('resize', function() {
        console.log(window.innerWidth);
        if(window.innerWidth<=960){
          dennerBox.style.transform=`translateX(-20%)`
          
        }
    })

})
</script>
</html>